const axios = require('axios');
const baseURL = 'https://test.ironmanapi.com:8017/basic';
const url = '/api/device/cmd';

const data = {
    cmd: "Signin",
    deviceCode: "03F572B878EA",
    sysCode: "03",
    user: {
        userType: "02",
        avatarUrl: "https://baidu-ai.bj.bcebos.com/face/faces.jpg",
        birthday: "2022-07-05",
        heartRate: 1,
        height: 12,
        nickName: "满目山河",
        sessionId: "1549933919437656064",
        sex: "男",
        userKey: "8db10a142e5a41e0a4141158f850687a",
        weight: 63
    }
}

const headers = {
    Authorization: 'Bearer d695b893-1705-43f6-8d08-4468b93bf519'
}

axios({
    method: 'post',
    baseURL,
    url,
    headers,
    data
}).then(response => {
    console.log("response");
    const {data} = response;
    console.log(JSON.stringify(data));
}).catch(error => {
    console.log("error");
    const {response} = error;
    const {data} = response;
    console.log(JSON.stringify(data));
});